<%@ page language="java" contentType="text/html; charset=UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<jsp:useBean id="user" class="model.User" scope="session" />

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dodavanje nove linije</title>

<script language="javascript" src="js/prototype-1.6.0.2.js"></script>
<script language="javascript" src="js/prototype-base-extensions.js"></script>
<script language="javascript" src="js/prototype-date-extensions.js"></script>
<script language="javascript" src="js/datepicker.js"></script>
<link rel="stylesheet" href="css/datepicker.css"></link>


</head>
<body>
<%
	if (user != null && user.isLoggedIn()) {
%>
<form action="/admin" method="post">
<table>
	<tr>
		<td align="right">Od:</td>
		<td><select name="fromTown">
			<c:forEach var="town" items="${sessionScope.allTowns}">
				<option><c:out value="${town.naziv}" /></option>
			</c:forEach>
		</select></td>
	</tr>
	<tr>
		<td align="right">Do:</td>
		<td><select name="toTown">
			<c:forEach var="town" items="${sessionScope.allTowns}">
				<option><c:out value="${town.naziv}" /></option>
			</c:forEach>
		</select></td>
	</tr>
	<tr>
		<td align=right>Cena:</td>
		<td><input type="text" name="cena" size="10" maxlength="7">din.</td>
	</tr>
	<tr>
		<td align=right>Polazak:<br>
		<small>(satnica)</small></td>
		<td><input type="text" id="my_datepicker" name="polazak" size="5"
			/></td>
	</tr>
	<tr>
		<td align=right>Dolazak:<br>
		<small>(satnica)</small></td>
		<td><input type="text" id="my_datepicker2" name="dolazak"
			size="5" class="timepicker" /></td>
	</tr>
	<tr>
		<td align="right">Povlastice:<br />
		<small>(drzite CTRL za vise)</small></td>
		<td><select name="bens" multiple="multiple" size="5">
			<c:forEach var="benefit" items="${sessionScope.allBenefits}">
				<option><a
					href="/benefits?showBenefit=true&benefitID=${benefit.sifra}">${benefit.naziv}</a></option>
			</c:forEach>
		</select></td>
	</tr>
	
	<tr>
		<td align="right">Prevoznici:</td>
		<td><select name="carrierID" size="5">
			<c:forEach var="carrier" items="${sessionScope.allCarriers}">
				<option value="${carrier.sifra.id}">${carrier.naziv}</option>
			</c:forEach>
		</select></td>
	</tr>	

	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td><input type="hidden" name="addedNewTrip" value="true"></td>
		<td><input type="submit" value="Dodaj"></td>
	</tr>
</table>

<script language="javascript">
	new Control.DatePicker('my_datepicker', {
		icon : 'images/clock.png',
		timePicker : true,
		datePicker : false,
		use24hrs : true,
	});
</script>
<script language="javascript">
	new Control.DatePicker('my_datepicker2', {
		icon : 'images/clock.png',
		timePicker : true,
		datePicker : false,
		use24hrs : true,
	});
</script>

<%
	} else {
%>

<p>Niste se prijavili! <br>
<a href="/logIn">Logovanje</a></p>

<%
	}
%>

<p><a href="/admin">Red voznje</a> <br>
<a href="/logIn?logOff=true">Odjava</a></p>
</body>
</html>